<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<%@ include file="../header.jsp"%>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>${systemName }</title>
    <link rel="shortcut icon" href="${contextPath}/resources/favicon.ico"> 
    <link href="${contextPath}/resources/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${contextPath}/resources/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <!-- Data Tables -->
    <link href="${contextPath}/resources/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <link href="${contextPath}/resources/css/animate.min.css" rel="stylesheet">
    <link href="${contextPath}/resources/css/style.min.css?v=4.1.0" rel="stylesheet">
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
       <div class="ibox-content">
        <form action="${contextPath}/system/good/list" class="form-horizontal" name="searchFrom"> 
        	<div class="form-group">
                <label class="col-sm-2 control-label">商品名称:</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="title" value="${param.title }">
                </div>
            </div>
             <div class="form-group">
                <label class="col-sm-2 control-label">订单状态</label>
                <div class="col-sm-10">
                    <select class="form-control m-b" name="isOnsale">
                    	 <option value="-100">所有 </option>
                        <option value="-1">已删除</option>
                        <option value="0">初始化</option>
                        <option value="1">审核中</option>
                        <option value="2">审核失败</option>
                        <option value="3">在售</option>
                        <option value="4">下架</option>
                        <option value="5">审核失败</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                 <div class="col-sm-4 col-sm-offset-2">
                     <button class="btn btn-primary" type="submit">查找</button>
                 </div>
                 <div class="col-sm-4 col-sm-offset-2">
                     <a href="${contextPath}/system/good/addInit" class="btn btn-primary">添加商品</a>
                 </div>
             </div>
        
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <table class="table table-striped table-hover dataTables-example">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>商品名称</th>
                                    <th>供应商</th>
                                    <th>市场价</th>
                                    <th>销售价</th>
                                    <th>成本价</th>
                                    <th>提成比例</th>
                                    <th>库存</th>
                                    <th>缩略图</th>
                                    <th>购买数量</th>
                                    <th>状态</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
	                            <c:forEach items="${page.resultRows}" var="good" varStatus="vs">  
								        <tr>  
								             <td>${good.id}</td>  
								             <td>${good.title}</td>  
								             <td>
								             	<c:choose>
								             		<c:when test="${good.supplierId eq 0}">系统商品</c:when>
								             		<c:otherwise>
								             	 	${good.supplierId}
								             	    </c:otherwise>
								             	 </c:choose>
								             </td>  
								             <td>${good.marketPrice}</td>
								             <td>${good.salePrice}</td> 
								             <td>${good.costPrice}</td> 
								             <td>${good.percentageRate}</td> 
								             <td>${good.amount}</td> 
								             <td><img src="${good.thumbnailImage}" height="50" width="50" alt="" /></td> 
								             <td>${good.buyCount }</td> 
								             <td>
								                  <c:choose> 
										            <c:when test="${good.isOnsale  eq -1}">已删除</c:when> 
										            <c:when test="${good.isOnsale  eq 0}">初始化 </c:when> 
										            <c:when test="${good.isOnsale  eq 1}">审核中</c:when> 
										            <c:when test="${good.isOnsale  eq 2}">审核失败</c:when> 
										            <c:when test="${good.isOnsale  eq 3}">在售 </c:when> 
										            <c:when test="${good.isOnsale  eq 4}">下架</c:when> 
										            <c:when test="${good.isOnsale  eq 5}">审核成功</c:when> 
										          </c:choose>
										     </td> 
										     <td>
										          <a href="${contextPath}/system/good/detail/${good.id}" class="btn btn-primary">查看</a>
										     	  <a href="${contextPath}/system/good/updateInit/${good.id}" class="btn btn-primary">编辑</a>
								                  <c:choose> 
										            <c:when test="${good.isOnsale  eq -1}"></c:when> 
										            <c:when test="${good.isOnsale  eq 0}">
										            	<c:choose>
										            	   <c:when test="${good.supplierId  eq 0}">
										            	   <a href="${contextPath}/system/good/shelves/${good.id}" class="btn btn-primary">上架</a>
										            	    </c:when> 
										            	 </c:choose>
										             </c:when> 
										            <c:when test="${good.isOnsale  eq 1}">
										            	<a href="${contextPath}/system/good/reviewGoodSuccess/${good.id}" class="btn btn-primary">审核通过</a>
										            	<a href="${contextPath}/system/good/reviewGoodFail/${good.id}" class="btn btn-primary">审核失败</a>
										            </c:when> 
										            <c:when test="${good.isOnsale  eq 2}">
										            </c:when> 
										            <c:when test="${good.isOnsale  eq 3}">
										            	<a href="${contextPath}/system/good/xiajia/${good.id}" class="btn btn-primary">下架</a>
										            </c:when> 
										            <c:when test="${good.isOnsale  eq 4}">
										            	<a href="${contextPath}/system/good/shelves/${good.id}" class="btn btn-primary">上架</a>
										            </c:when> 
										            <c:when test="${good.isOnsale  eq 5}">
										            </c:when> 
										          </c:choose>
										          <a href="${contextPath}/system/good/delete/${good.id}" class="btn btn-primary">删除</a>
										     </td> 
								         </tr>  
								</c:forEach>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <jsp:include page="../page.jsp">
              <jsp:param value="searchFrom" name="formName" />
        </jsp:include>
        </form>
        </div>
    </div>
    <script src="${contextPath}/resources/js/jquery.min.js?v=2.1.4"></script>
    <script src="${contextPath}/resources/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="${contextPath}/resources/js/plugins/jeditable/jquery.jeditable.js"></script>
    <script src="${contextPath}/resources/js/plugins/dataTables/jquery.dataTables.js"></script>
    <script src="${contextPath}/resources/js/plugins/dataTables/dataTables.bootstrap.js"></script>
    <script src="${contextPath}/resources/js/content.min.js?v=1.0.0"></script>
</body>
</html>
